Four parameters such as Speed, Safety, Environment and Riding Quality were used to assign importance weight to each highway functional classification namely, arterial, collector and local.
First we need to load libraries:
library(ahp)
library(data.tree)
Then we load input file hfc.ahp and look to the file:
ahpFile <- system.file("extdata", "hfc.ahp", package="ahp")
cat(readChar(ahpFile, file.info(ahpFile)$size))
## Version: 2.0
## Alternatives: &alternatives
## # Here we assign speed (max-120 kmph, min-60 kmph), safety(max - 10, min-0),
## # Environment(max-10, min-0), Riding Quality (max-100, min-0).
## Arterial:
## Speed: 120
## Safety: 10
## Environment: 6
## Riding Quality: 90
## Collector:
## Speed: 80
## Safety: 6
## Environment: 8
## Riding Quality: 70
## Local:
## Speed: 60
## Safety: 4
## Environment: 10
## Riding Quality: 50
## #
## # End of Alternatives Section
## #####################################
## # Goal Section
## #
## Goal:
## # A Goal HAS preferences (within-level comparison) and HAS Children (items in level)
## name: Assigning Importance Weight
## preferences:
## pairwise:
## # preferences are defined pairwise
## # 1 means: A is equal to B
## # 9 means: A is highly preferrable to B
## # 1/9 means: B is highly preferrable to A
## - [Speed, Safety, 1/2]
## - [Speed, Environment, 5]
## - [Speed, Riding Quality, 4]
## - [Safety, Environment, 5]
## - [Safety, Riding Quality, 4]
## - [Environment, Riding Quality, 1/4]
## children:
## Speed:
## preferences:
## pairwise:
## - [Arterial, Collector, 3]
## - [Arterial, Local, 6]
## - [Collector, Local, 3]
## children: *alternatives
## Safety:
## preferences:
## pairwise:
## - [Arterial, Collector, 2]
## - [Arterial, Local, 4]
## - [Collector, Local, 2]
## children: *alternatives
## Environment:
## preferences:
## pairwise:
## - [Arterial, Collector, 1/3]
## - [Arterial, Local, 1/6]
## - [Collector, Local, 1/2]
## children: *alternatives
## Riding Quality:
## preferences:
## pairwise:
## - [Arterial, Collector, 2]
## - [Arterial, Local, 5]
## - [Collector, Local, 2]
## children: *alternatives
## #
## # End of Goal Section
## #####################################
Next is to calculate priorities (eigenvalues) and visualize our data
hfcAhp <- Load(ahpFile)
Calculate(hfcAhp)
Visualize(hfcAhp)
And finally is to present resuls in table
AnalyzeTable(hfcAhp)
| Weight | Arterial | Collector | Local | Inconsistency | |
|---|---|---|---|---|---|
| Assigning Importance Weight | 100.0% | 57.4% | 27.3% | 15.3% | 8.7% |
| Safety | 46.9% | 26.8% | 13.4% | 6.7% | 0.0% |
| Speed | 33.4% | 21.9% | 8.4% | 3.2% | 1.6% |
| Riding Quality | 13.7% | 8.1% | 3.8% | 1.8% | 0.5% |
| Environment | 6.0% | 0.6% | 1.8% | 3.6% | 0.0% |
P.S. Analysis were done in RStudio, Version 0.99.902 (R version 3.3.0). OS - MAC